<script type="text/javascript">
    $("#img_lib_list").on("hidden.bs.modal", function() {
        $(this).removeData("bs.modal");
    });
    function sel_majia() {
        var article_id = $("#article_id").val();
        var majia_type = $("#majia_type").val();
        if(majia_type == 0){
            $("#user_info").html("");
            $("#user_info").hide();
            return false;
        }
        $.ajax({
            type:'get',
            url:'index.php?c=article&m=get_majia',
            data:{"type":majia_type, "article_id":article_id},
            cache:false,
            dataType:'json',
            success:function(data){
                if(data.errorCode == 0) {
                    var userList = data.responseData;
                    var userHtml = '<option value="0">请选择</option>';
                    for(var i = 0; i < userList.length; i++){
                        userHtml+= '<option value="'+userList[i]["uid"]+'">'+userList[i]["nick_name"]+'</option>';
                    }
                    $("#user_info").html(userHtml);
                    $("#user_info").show();
                    return;
                }else{
                    alert(data.errorMsg);
                }
            },
            error:function(data){
                alert(data);
            }
        });
    }
    function set_author(){
        var author_uid = $("#user_info").val();
        var talk_nick_name = $("#user_info").find("option:selected").text();

        $("#author_uid").val(author_uid);
        $("#talk_nick_name").val(talk_nick_name);
    }
    function on_submit(){
        var content = $('#content').val();
        if(!content){
            alert('内容不能为空');
            return false;
        }
        $("#reply_form").submit();
    }
    function check_img(id, path){
        $("#"+id).val(path);
        //拼团时选图片专用
        $("#"+id+"_img").attr("src","<?=IMG_URL?>"+path);
        /////////////////

        $('#close_<?php echo $id;?>').show();

        $('#img_lib_list').modal('hide');
        $('#img_lib_list').click();
    }
</script>
<style>
    .img_d{width: 171px;height: 160px; float: left;border: 1px solid #e7eaec;padding: 5px;margin: 5px;}
    .img_d_1{margin-top: 30px;display: block;margin-left: 30px;}
    .img_d_2{margin-top: 35px;display: block;}
</style>
<div class="tab-pane active" id="horizontal-form">

    <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
        <h5 class="modal-title"><?php echo $pageTitle;?></h5>
    </div>

    <div class="img_list"  id="data_img_list">
        <?php foreach($imgList as $img){
            if($img["category"] == 1){
                $cls = "img_d_1";$w = "100px";$h = "100px";
            }else{
                $cls = "img_d_2";$w = "160px";$h = "90px";
            }
            ?>
            <div class="img_d">
                <a href="javascript:void(0)" onclick="check_img('<?php echo $id;?>','<?php echo $img["path"];?>')" class="<?php echo $cls;?>"><img src="<?php echo IMG_URL.$img["path"];?>" width="<?php echo $w;?>" height="<?php echo $h;?>"></a>
            </div>
        <?php } ?>
        <div class="clearfix"></div>
    </div>
    <div id="page_img_list">
        <?php echo $multipage;?>
        <div class="clearfix"></div>
    </div>
</div>
